home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / C⁄C++ OS8 / LayerGroups / LayerGroupsDoc.cp < prev    next >
Encoding:
Text File  |  1998-10-23  |  2.0 KB  |  124 lines  |  [TEXT/CWIE]

  1. // LayerGroupsDoc.cp -- document-level functions
  2.  
  3. #include <Types.h>
  4. #include <Events.h>
  5. #include <Menus.h>
  6. #include "Globals.h"
  7. #include "ResourceDefs.h"
  8. #include "Miscellany.h"
  9. #include "LayerGroupsEngine.h"
  10.  
  11. #include "AboutDialog.h"
  12. #include "EditFields.h"
  13. #include "DDocData.h"
  14. #include "TabPanel.h"
  15. #include "DDocData.h"
  16. #include "PopupGroupBox.h"
  17. #include "DDocData.h"
  18. #include "Listbox.h"
  19. #include "LayerGroupsDoc.h"
  20.  
  21. //----------
  22. LayerGroupsDoc::LayerGroupsDoc ()
  23. {
  24.     mEngine = new LayerGroupsEngine;
  25.  
  26.     mTabPanelPtr = nil;
  27.     mPopupGroupBoxPtr = nil;
  28.     mListboxPtr = nil;
  29. }
  30.  
  31. //----------
  32. LayerGroupsDoc::~LayerGroupsDoc ()
  33. {
  34. }
  35.  
  36. //----------
  37. LayerGroupsEngine*        LayerGroupsDoc::GetEngine ()
  38. {
  39.     return (LayerGroupsEngine*) mEngine;
  40. }
  41.  
  42. //----------
  43. void    LayerGroupsDoc::OpenWindows ()
  44. {
  45.     LayerGroupsEngine*        engine = GetEngine ();
  46.     DDocData*        docData = engine->GetDocData ();
  47.  
  48.     TabPanel::Create (this, docData);
  49.     PopupGroupBox::Create (this, docData);
  50.     Listbox::Create (this, docData);
  51. }
  52.  
  53. //----------
  54. Boolean        LayerGroupsDoc::WouldCloseDoc (
  55.     WindowPtr        windPtr)
  56. {
  57.     short        numOpen = 0;
  58.  
  59.     if (mTabPanelPtr != nil)        numOpen++;
  60.     if (mPopupGroupBoxPtr != nil)        numOpen++;
  61.     if (mListboxPtr != nil)        numOpen++;
  62.  
  63.     return (numOpen <= 1);
  64. }
  65.  
  66. //----------
  67. void    LayerGroupsDoc::DoInvokeAbout ()
  68. {
  69.     if (CAboutDialog::GetAboutDialog ()) {
  70.  
  71.         // post-invoke code
  72.     }
  73. }
  74.  
  75. //----------
  76. void    LayerGroupsDoc::DoShowEditFields ()
  77. {
  78.     DEditFieldsData        data;
  79.  
  80.  
  81.     // pre-invoke code
  82.  
  83.     if (CEditFields::GetEditFields (&data)) {
  84.  
  85.         // post-invoke code
  86.  
  87.     }
  88. }
  89.  
  90. //----------
  91. Boolean        LayerGroupsDoc::DoCommand (
  92.     long        inCommand)
  93. {
  94.     Boolean        result = true;
  95.  
  96.     switch (inCommand) {
  97.         case cmdSave:
  98.                 DoSave ();
  99.             break;
  100.         case cmdSaveAs:
  101.                 DoSaveAs ();
  102.             break;
  103.         case cmdRevert:
  104.                 DoRevert ();
  105.             break;
  106.         case cmdPageSetup:
  107.                 DoPageSetup ();
  108.             break;
  109.         case cmdPrint:
  110.                 DoPrint ();
  111.             break;
  112.         case cmdInvokeAbout:
  113.                 DoInvokeAbout ();
  114.             break;
  115.         case cmdShowEditFields:
  116.                 DoShowEditFields ();
  117.             break;
  118.  
  119.         default:
  120.                 result = false;
  121.     } // switch
  122.     return result;
  123. }
  124.